﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace MagicFight
{
    public class GreenGlow : Effect
    {
        #region Static
        static Dictionary<int, Texture2D> radiusTextures = new Dictionary<int, Texture2D>();
        public static void init(Game game)
        {
            for (int i = 100; i <= 400; i += 50)
                radiusTextures.Add(i, game.Content.Load<Texture2D>("Images\\Radius\\" + i.ToString()));
        }
        #endregion

        int radius;
        public double timer = 500;

        public GreenGlow(Vector2 pos, int r)
            : base(pos)
        {
            if (!radiusTextures.ContainsKey(r)) r = 100;
            this.radius = r;
        }

        public override void Update(GameTime gameTime)
        {
            timer -= gameTime.ElapsedGameTime.TotalMilliseconds;
            if (timer < 0) alive = false;
        }

        public override void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {
            Texture2D greenGlow = radiusTextures[radius];
            spriteBatch.Draw(greenGlow, position - new Vector2(greenGlow.Width / 2, greenGlow.Height / 2), Color.White);  //          desenhar glow vermelho em Map.GetCentralPos(MousePos)
        }
    }
}

 

